<?php $this->placeholder('onReady')->captureStart() ?>
    
	$("#<?php echo $this->id_tablesorter?>").tablesorter();

    $(document).on("click",'span.status a', function(e){
        sgitObject.n_openform = noty({type:'information',text: 'Espere, cargando formulario'});
    	e.preventDefault();
    	$.get(this.href,function(data){
			$('#dialog')
            .html(data)
            .dialog({buttons: sgitObject.botones.botonesOnlySave})
            .dialog('open');
            $('.fecha').datepicker();   
            sgitObject.n_openform.close()
 
		})

    })
    

<?php $this->placeholder('onReady')->captureEnd() ?>


<br />

<?=$this->msg($this->proyecto['proyecto'].' - '.$this->translate('Seguimiento Inversiones'),'head',null,false);?>

<?php echo $this->anchor($this->controllerName.'/insertar/id_proyecto/'.$this->id_proyecto,'Añadir Concepto',array('class'=>'utiladd'));?>

<div class="ui-widget-header importe_noc">
<?php echo $this->translate('Importe NOC');?> : <?=$this->unit('MONEY',$this->proyecto['noc'],0) ?><br />
</div>

<br />
<?if(!empty($this->rows['conceptos'])):?>
<div style="float: right;">
<span class="previsto"><a ><?php echo $this->translate('Previsto');?></a></span>
<span class="contratado"><a ><?php echo $this->translate('Contratado');?></a></span>
<span class="contabilizado"><a ><?php echo $this->translate('Contabilizado');?></a></span>
</div>
<br />
<table id="myTable" width="100%" class="tablesorter"> 
<thead>
<tr> 
	<th><?php echo $this->translate('Concepto');?></th> 
    
    <?foreach($this->rows['fechas'] as $f):?>
        <th width="70px"><?=$f['fechas']?></th>
    <?endforeach?>
    
    <th width="70px"><?php echo $this->translate('Contabilizado');?></th>
	<th width="70px"><?php echo $this->translate('Contratado');?></th>
    <th width="70px"><?php echo $this->translate('Previsto');?></th>
    <th width="70px"><?php echo $this->translate('Avance');?></th>
</tr>
</thead>
<tbody> 
<?foreach($this->rows['conceptos'] as $k => $v):?>
<tr id="fila-<?=$v['id'];?>"> 
	<td valign="top"><?=$k?></td>
    <?foreach($this->rows['fechas'] as $k => $f):?>
        <td align="right">
        <span class="status <?=$v[$k]['status']?>">
            <?=($v[$k]['id']) ? $this->anchor('/proyectosdc-capex-detalle/editar/id_proyecto/'.$this->id_proyecto.'/id/'.$v[$k]['id'],$this->unit('MONEY',$v[$k]['importe_'.$v[$k]['status']],0)) : '';?>
        </span>
        <span><?=$this->dateTo($v[$k]['fecha_contabilizado'],'MMM-YY')?></span>
        </td>
   <?endforeach?>
   <td align="right" valign="top"><?=$this->unit('MONEY',$v['importe_contabilizado'] ? $v['importe_contabilizado'] : null,0)?></td>
   <td align="right" valign="top"><?=$this->unit('MONEY',$v['importe_contratado'] ? $v['importe_contratado'] : null,0)?></td>
   <td align="right" valign="top"><?=$this->unit('MONEY',$v['importe_previsto'] ? $v['importe_previsto'] : null,0)?></td>
   <td align="right" valign="top"><?=$this->unit('MONEY',$v['importe_total'] ? $v['importe_total'] : null,0)?></td>
     
</tr> 
<?endforeach?>
</tbody>
<tfoot>
<tr> 
	<th><?php echo $this->translate('Total');?></th> 
    <?foreach($this->rows['fechas'] as  $f):?>
        <th><?=$this->unit('MONEY',$f['importes'],0)?></th>
    <?endforeach?>
    <th><?=$this->unit('MONEY',$this->rows['importe_contabilizado'] ? $this->rows['importe_contabilizado'] : null,0)?></th>
	<th><?=$this->unit('MONEY',$this->rows['importe_contratado'] ? $this->rows['importe_contratado'] : null,0)?></th>
    <th><?=$this->unit('MONEY',$this->rows['importe_previsto'] ? $this->rows['importe_previsto'] : null,0)?></th>
    <th><?=$this->unit('MONEY',$this->rows['importe_total'] ? $this->rows['importe_total'] : null,0)?></th>
</tr> 
</tfoot> 
</table>

<?else:
print $this->msg('No hay Información','head',null,true);
endif?>
<br />
<br />
<br />
<br />
<div>
<h1 class="h1_head"><?php echo $this->translate('Notas');?> </h1>

<?php echo $this->anchor('/proyectosdc-capex/editar/id/'.$this->id_proyecto,'Añadir',array('class'=>'utileditar'));?>
    <div id="notas" class="ui-state-highlight">
        <?=$this->text($this->proyecto['notas_capex'])?>&nbsp;
    </div>
</div>

<div style="height:420px">&nbsp;</div>
